package com.fas.hehe.system.model;

import java.io.Serializable;

import nl.bitwalker.useragentutils.DeviceType;

/**
 * 
 * 登录用户信息
 *
 * @Copyright: Copyright (c) 2016 FAS
 * @anthor yixiaoping<thinker1013@163.com>
 * @since 2016年1月8日 下午11:55:59
 * @version V1.0
 */
public class LoginUser implements Serializable {

	public enum LoginBy {
		USERNAME("用户名登录", 1), EMAIL("邮箱登录", 2), MOBILE("手机号码登录", 3);
		private String name;
		private int code;

		LoginBy(String name, int code) {
			this.name = name;
			this.code = code;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

	}

	private static final long serialVersionUID = 1L;
	private Long userId; // 员工ID;
	private String userName; // 账号;
	private Long companyId; // 公司ID
	private Long departmentId; // 部门ID
	private String mobile; // 员工手机号;
	private String email;// 邮箱
	private String userNameZh; // 员工姓名;
	private boolean superUser;// 是否超级账号
	private LoginBy loginBy;// 登录方式(用户名/邮箱/手机号码)
	private DeviceType loginDeviceType;// 登录设备类型
	private String pramaryPrincipal;

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public Long getCompanyId() {
		return companyId;
	}

	public void setCompanyId(Long companyId) {
		this.companyId = companyId;
	}

	public Long getDepartmentId() {
		return departmentId;
	}

	public void setDepartmentId(Long departmentId) {
		this.departmentId = departmentId;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getUserNameZh() {
		return userNameZh;
	}

	public void setUserNameZh(String userNameZh) {
		this.userNameZh = userNameZh;
	}

	public boolean isSuperUser() {
		return superUser;
	}

	public void setSuperUser(boolean superUser) {
		this.superUser = superUser;
	}

	public DeviceType getLoginDeviceType() {
		return loginDeviceType;
	}

	public void setLoginDeviceType(DeviceType loginDeviceType) {
		this.loginDeviceType = loginDeviceType;
	}

	public LoginBy getLoginBy() {
		return loginBy;
	}

	public void setLoginBy(LoginBy loginBy) {
		this.loginBy = loginBy;
	}

	public String getPramaryPrincipal() {
		switch (loginBy) {
			case USERNAME:
				return this.getUserName();
			case EMAIL:
				return this.getEmail();
			case MOBILE:
				return this.getMobile();
			default:
				return this.getUserName();
		}

	}

}
